﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace StructGoTest.GameObjects {

	public class Player : GameObject {

		public Player() {
			// Move
			CanMove = true;
			BaseHorizontalMoveSpeed = 100;
			// Draw
			IsDrawable = true;
			Texture = BlobTestGame.PlayerTexture;
			Width = BlobTestGame.PlayerTexture.Width;
			Height = BlobTestGame.PlayerTexture.Height;
			Position = new Vector2(200, BlobTestGame.Floor - Height);
			Color = Color.White;
		}


		public override void Move(GameTime gameTime) {
			float distanceMoved = BaseHorizontalMoveSpeed*(float) gameTime.ElapsedGameTime.TotalSeconds;

			BlobTestGame.CurrentKeyboardState = Keyboard.GetState();

			// TODO: This code needs to be in an InputManager and 
			if (BlobTestGame.CurrentKeyboardState.IsKeyDown(Keys.A)) {
				Position = new Vector2(Position.X - distanceMoved, Position.Y);
			}
			if (BlobTestGame.CurrentKeyboardState.IsKeyDown(Keys.D)) {
				Position = new Vector2(Position.X + distanceMoved, Position.Y);
			}

			base.Move(gameTime);
		}

	}

}